package com.muse.mapstruct;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface CarMapper {
    CarMapper INSTANCE = Mappers.getMapper(CarMapper.class);

    @Mapping(source = "numberOfSeats", target = "seatCount")
    @Mapping(source = "type", target = "typeDto")
    // 默认对象之间是采用浅拷贝的，如果想要进行深拷贝，对字段进行手动映射，这样在实现类出来的时候就会new出来要映射的引用对象了，如下所示：
    @Mapping(source = "master.name", target = "master.name")
    @Mapping(source = "master.age", target = "master.age")
    CarDto carToCarDto(Car car);
}
